
import { ReactNode, CSSProperties } from 'react'

export interface IVirtualWaterfallProps {
  gap: number; // 卡片间隔
  column: number; // 瀑布流列数
  pageSize: number; // 单次请求数据数量
  request?: (page: number, pageSize: number) => Promise<ICardItem[]>; // 数据请求方法
  children?: string | ReactNode;
  item?: Function;//卡片item
}

export interface ICardItem {
  id: number | string;
  width: number;
  height: number;
  [key: string]: any;
}

export interface IColumnQueue {
  list: IRenderItem[];
  height: number;
}
//渲染视图项
export interface IRenderItem {
  item: ICardItem; //数据源
  y: number; //卡片距离列表顶部的距离
  h: number; //卡片自身高度
  style: CSSProperties; //用于渲染视图上的样式(宽、高、偏移量)
}
export interface IItemRect {
  width: number;
  height: number;
}

export interface DataState {
  loading: boolean;
  isFinish: boolean;
  currentPage: number;
  list: ICardItem[];
}

export interface IBookColumnQueue {
  list: IBookRenderItem[];
  height: number;
}

export interface IBookRenderItem {
  item: ICardItem;
  y: number;
  h: number;
  imageHeight: number;
  style: CSSProperties;
}

export interface IBookItemRect {
  width: number;
  height: number;
  imageHeight: number;
}
